date_sun_info
Returns an array with information about the start/end of sunset/sunrise and dusk
date_sun_info()
function returns an array containing information about sunrise/sunset and dusk start/end of dusk for a specified date and location.
Tip: See the date_sunrise()
function to return the sunrise time of the specified date and place.
Tip: See the date_sunset()
function to return the sunset time of the specified date and place.
Return information about sunrise/sunset and dusk start/end at latitude 31.2283 and longitude 121.4755 on January 1, 2016:
<?php $sun_info = date_sun_info ( strtotime ( "2016-01-01" ) , 31.2283 , 121.4755 ) ; foreach ( $sun_info as $key => $val ) { echo " $key : " . date ( "H:i:s" , $val ) . "<br>" ; } ?>
Try it yourself
date_sun_info ( timestamp , latitude , longitude ) ;
parameter | describe |
---|---|
timestamp | Required. Specify timestamp. |
latitude | Required. Required. latitude is specified, measured in degrees. |
longitude | Required. Required. Specify longitude, count in degrees. |